import log from '@dfeidao/atom-nodejs/logger/log';
import { IncomingHttpHeaders } from 'http';
import complex_query from '@dfeidao/atom-nodejs/db/complex-query';
import { systemid, productid } from '../../atom/config';
import query from '@dfeidao/atom-nodejs/db/query';
interface Message {
	plan_cla_attr_no: string
}

// interface IWebResult {
// 	data: unknown;
// 	cookie?: {
// 		[name: string]: string;
// 	} | null;
// 	content_type?: string;
// 	headers?: {
// 		[key: string]: string[];
// 	};
// 	attachment?: string;
// 	redirect?: string;
// 	status_code?: number;
// }

export default async function atom(message: Message, action_id: string, session_id: string, headers: IncomingHttpHeaders) {
	// const xx = complex_query(action_id, session_id, systemid);
	// const p = await xx
	// 	.add_field('plan_type', 'plan_type_no', 'plan_type_no')
	// 	.add_field('plan_type', 'plan_type_name', 'plan_type_name')
	// 	.add_field('plan_type', 'plan_cla_attr_no', 'plan_cla_attr_no')
	// 	.where_eq_tb('plan_type', 'plan_cla_attr_no', 'plan_classify', 'plan_cla_attr_no')
	// 	.where_eq('plan_type', ' plan_cla_attr_no', message.plan_cla_attr_no.toString())
	// 	.exec();
	const { prepare, exec } = query(action_id, session_id, systemid);
	prepare('plan_type', ['plan_type_no', 'plan_type_name', 'plan_cla_attr_no'], { productid, plan_cla_attr_no: message.plan_cla_attr_no }, 2, 1, [], []);
	const [p] = await exec();
	return {
		p
	};
}
